import Vue from 'vue'
import Router from 'vue-router'
// 实现各个页面的路由跳转
Vue.use(Router)
//布局页面
const commonIndex = resolve => require([ '@/components/commonIndex'], resolve)

//首页应当是学生端首页或者登陆页面
//登陆页
const loginPage = resolve => require(['@/module/common/login/login.vue'], resolve)
const silder = resolve => require(['@/module/common/silder/silder.vue'], resolve)
const person = resolve => require(['@/module/common/person/person.vue'], resolve)
const search = resolve => require([ '@/module/common/search/search.vue'], resolve)
const redirect =  resolve => require(['@/module/common/redirect/redirect.vue'], resolve)
const message =  resolve => require(['@/module/common/message/message.vue'], resolve)

//---------------------------------品牌商端------------------------------------------
const home =  resolve => require(['@/module/brand/home/home.vue'], resolve)
const ckphoto =  resolve => require(['@/module/brand/ckphoto/ckphoto.vue'], resolve)
const ckphotoDetail =  resolve => require(['@/module/brand/ckphoto/ckphotoDetail.vue'], resolve)
const push =  resolve => require(['@/module/brand/push/push.vue'], resolve)
const audition =  resolve => require(['@/module/brand/audition/audition.vue'], resolve)
const resolve =  resolve => require(['@/module/brand/resolve/resolve.vue'], resolve)
const resolveDetail =  resolve => require(['@/module/brand/resolve/resolveDetail.vue'], resolve)
const confirm =  resolve => require(['@/module/brand/confirm/confirm.vue'], resolve)
const confirmList =  resolve => require(['@/module/brand/confirm/confirmList.vue'], resolve)
const takeDelivery =  resolve => require(['@/module/brand/takeDelivery/takeDelivery.vue'], resolve)
const takeDeliveryDetail =  resolve => require(['@/module/brand/takeDelivery/takeDeliveryDetail.vue'], resolve)
const oneck =  resolve => require(['@/module/brand/oneck/oneck.vue'], resolve)
const oneckDetail =  resolve => require(['@/module/brand/oneck/oneckDetail.vue'], resolve)
const oneresolve =  resolve => require(['@/module/brand/oneresolve/oneresolve.vue'], resolve)
const oneresolveDetail =  resolve => require(['@/module/brand/oneresolve/oneresolveDetail.vue'], resolve)
const checkstyle =  resolve => require(['@/module/brand/checkstyle/checkstyle.vue'], resolve)

//---------------------------------供应商端------------------------------------------
const indexPage =  resolve => require(['@/module/supplier/index/index.vue'], resolve)
//样衣波段
const band = resolve => require(['@/module/supplier/band/band.vue'], resolve)
const bandDetail = resolve => require(['@/module/supplier/band/bandDetail.vue'], resolve)
const bandUpload = resolve => require(['@/module/supplier/band/bandUpload.vue'], resolve)
//样衣初选
const primary = resolve => require(['@/module/supplier/primary/primary.vue'], resolve)
const primaryDetail = resolve => require(['@/module/supplier/primary/primaryDetail.vue'], resolve)
const primaryDelivery = resolve => require(['@/module/supplier/primary/primaryDelivery.vue'], resolve)
//淘汰样衣
const eliminate = resolve => require(['@/module/supplier/eliminate/eliminate.vue'], resolve)
const eliminateDetail = resolve => require(['@/module/supplier/eliminate/eliminateDetail.vue'], resolve)
//二审资料补充
const secondInstance = resolve => require(['@/module/supplier/secondInstance/secondInstance.vue'], resolve)
const secondInstanceDetail = resolve => require(['@/module/supplier/secondInstance/secondInstanceDetail.vue'], resolve)
//样衣申请列表
const apply = resolve => require(['@/module/supplier/apply/apply.vue'], resolve)
const applyDetail = resolve => require(['@/module/supplier/apply/applyDetail.vue'], resolve)
const applyEditDetail = resolve => require(['@/module/supplier/apply/applyEditDetail.vue'], resolve)

const routes = [
  { path: '/', name: '/', component: loginPage, redirect:'/login' }, //首页
  { path: '/login', name: 'login', component: loginPage }, // 登录
  { path: '/silder', name: 'silder', component: silder }, 
  { path: '/redirect', name: 'redirect', component: redirect }, 
  { path: '/message', name: 'message', component: message }, 
  { 
    path: '/index',
    name: 'index', 
    component: commonIndex, 
    redirect: '/indexPage', 
    children: [
      { path: '/indexPage', name: 'indexPage', component: indexPage, meta: { requireAuth: true } }, 
      { path: '/person', name: 'person', component: person, meta: { requireAuth: true } }, 
      { path: '/band', name: 'band', component: band, meta: { requireAuth: true } },
      { path: '/bandDetail', name: 'bandDetail', component: bandDetail, meta: { requireAuth: true } },
      { path: '/bandUpload', name: 'bandUpload', component: bandUpload, meta: { requireAuth: true } },
      { path: '/search', name: 'search', component: search, meta: { requireAuth: true } },
      { path: '/primary', name: 'primary', component: primary, meta: { requireAuth: true } },
      { path: '/primaryDetail', name: 'primaryDetail', component: primaryDetail, meta: { requireAuth: true } },
      { path: '/primaryDelivery', name: 'primaryDelivery', component: primaryDelivery, meta: { requireAuth: true } },
      { path: '/eliminate', name: 'eliminate', component: eliminate, meta: { requireAuth: true } },
      { path: '/eliminateDetail', name: 'eliminateDetail', component: eliminateDetail, meta: { requireAuth: true } },
      { path: '/secondInstance', name: 'secondInstance', component: secondInstance, meta: { requireAuth: true } },
      { path: '/secondInstanceDetail', name: 'secondInstanceDetail', component: secondInstanceDetail, meta: { requireAuth: true } },
      { path: '/apply', name: 'apply', component: apply, meta: { requireAuth: true } },
      { path: '/applyDetail', name: 'applyDetail', component: applyDetail, meta: { requireAuth: true } },
      { path: '/applyEditDetail', name: 'applyEditDetail', component: applyEditDetail, meta: { requireAuth: true } },
      
      //品牌商主页
      { path: '/home', name: 'home', component: home, meta: { requireAuth: true } }, 
      { path: '/ckphoto', name: 'ckphoto', component: ckphoto, meta: { requireAuth: true } }, 
      { path: '/ckphotoDetail', name: 'ckphotoDetail', component: ckphotoDetail, meta: { requireAuth: true } }, 
      { path: '/push', name: 'push', component: push, meta: { requireAuth: true } }, 
      { path: '/audition', name: 'audition', component: audition, meta: { requireAuth: true } }, 
      { path: '/resolve', name: 'resolve', component: resolve, meta: { requireAuth: true } }, 
      { path: '/resolveDetail', name: 'resolveDetail', component: resolveDetail, meta: { requireAuth: true } },
      { path: '/confirm', name: 'confirm', component: confirm, meta: { requireAuth: true } }, 
      { path: '/confirmList', name: 'confirmList', component: confirmList, meta: { requireAuth: true } }, 
      { path: '/takeDelivery', name: 'takeDelivery', component: takeDelivery, meta: { requireAuth: true } },
      { path: '/takeDeliveryDetail', name: 'takeDeliveryDetail', component: takeDeliveryDetail, meta: { requireAuth: true } },
      { path: '/oneck', name: 'oneck', component: oneck, meta: { requireAuth: true } },
      { path: '/oneckDetail', name: 'oneckDetail', component: oneckDetail, meta: { requireAuth: true } },
      { path: '/oneresolve', name: 'oneresolve', component: oneresolve, meta: { requireAuth: true } },
      { path: '/oneresolveDetail', name: 'oneresolveDetail', component: oneresolveDetail, meta: { requireAuth: true } },
      { path: '/checkstyle', name: 'checkstyle  ', component: checkstyle, meta: { requireAuth: true } },
    ]
  },
]

var router = new Router({ routes })

export default router
